<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="/static/backend/Style/skin.css" />
    <script type="text/javascript" src="/static/jquery-3.3.1.min.js"></script>
</head>
    <body>
        <form action="/backend/banner/insert" method="post">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <!-- 头部开始 -->
            <tr>
                <td width="17" valign="top" background="/static/backend/Images/mail_left_bg.gif">
                    <img src="/static/backend/Images/left_top_right.gif" width="17" height="29" />
                </td>
                <td valign="top" background="/static/backend/Images/content_bg.gif">
                    <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" background="/static/backend/Images/content_bg.gif">
                        <tr><td height="31"><div class="title">添加轮播图</div></td></tr>
                    </table>
                </td>
                <td width="16" valign="top" background="/static/backend/Images/mail_right_bg.gif"><img src="/static/backend/Images/nav_right_bg.gif" width="16" height="29" /></td>
            </tr>
            <!-- 中间部分开始 -->
            <tr>
                <!--第一行左边框-->
                <td valign="middle" background="/static/backend/Images/mail_left_bg.gif">&nbsp;</td>
                <!--第一行中间内容-->
                <td valign="top" bgcolor="#F7F8F9">
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <!-- 空白行-->
                        <tr><td colspan="2" valign="top">&nbsp;</td><td>&nbsp;</td><td valign="top">&nbsp;</td></tr>
                        <tr>
                            <td colspan="4">
                                <table>
                                    <tr>
                                        <td width="100" align="center"><img src="/static/backend/Images/mime.gif" /></td>
                                        <td valign="bottom"><h3 style="letter-spacing:1px;">请按要求填写</h3></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <!-- 一条线 -->
                        <tr>
                            <td height="40" colspan="4">
                                <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                                    <tr><td></td></tr>
                                </table>
                            </td>
                        </tr>
                        <!-- 添加栏目开始 -->
                        <tr>
                            <td width="2%">&nbsp;</td>
                            <td width="96%">
                                <table width="100%">
                                    <tr>
                                        <td colspan="2">
                                           
                                                <table width="100%" class="cont">
                                                    <tr>
                                                        <td width="2%">&nbsp;</td>
                                                        <td>轮播图名称：</td>
                                                        <td width="20%"><input class="text" type="text" name="banner_name" value="" /></td>
                                                        <td>设置轮播图名称</td>
                                                        <td width="2%">&nbsp;</td>
                                                    </tr>
                                                  
                                                
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                        <td>是否隐藏：</td>
                                                        <td>
                                                            <input type="radio" name="is_hidden" value="1" /> 是 
                                                            <input type="radio" name="is_hidden" value="0" checked /> 否
                                                        </td>
                                                        <td>设置该栏目是否隐藏</td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                               
                                                
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                        <td>轮播图图片：</td>
                                                        <td><input type="file" id="id-input-file-2" 
                                            name="banner_img" onchange="upimg(this)" />
                                            
                                            <img src="" id="img_view" style="width:200px;"/>
                                            <input type="hidden" name="imgSrc" value="" id="img_src_input"></td>
                                                        <td>图片预览</td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                        <td>图片排序：</td>
                                                        <td width="20%"><input class="text" type="text" name="banner_sort" value="" /></td>
                                                        <td>设置轮播图播放顺序</td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                        <td>描述：</td>
                                                        <td><textarea
                                                            name="banner_describe"></textarea></td>
                                                        <td>图片描述</td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                    <tr>
                                                        <td>&nbsp;</td>
                                                        <td colspan="3"><input class="btn" type="submit" value="提交" /></td>
                                                        <td>&nbsp;</td>
                                                    </tr>
                                                </table>
                                            
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td width="2%">&nbsp;</td>
                        </tr>
                        <!-- 添加栏目结束 -->
                        <tr>
                            <td height="40" colspan="4">
                                <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                                    <tr><td></td></tr>
                                </table>
                            </td>
                        </tr>
                       
                    </table>
                </td>
                <td background="/static/backend/Images/mail_right_bg.gif">&nbsp;</td>
            </tr>
            <!-- 底部部分 -->
            <tr>
                <td valign="bottom" background="/static/backend/Images/mail_left_bg.gif">
                    <img src="/static/backend/Images/buttom_left.gif" width="17" height="17" />
                </td>
                <td background="/static/backend/Images/buttom_bgs.gif">
                    <img src="/static/backend/Images/buttom_bgs.gif" width="17" height="17">
                </td>
                <td valign="bottom" background="/static/backend/Images/mail_right_bg.gif">
                    <img src="/static/backend/Images/buttom_right.gif" width="16" height="17" />
                </td>           
            </tr>
        </table>
    </form>
    </body>
</html>
<script type="text/javascript">
  function upimg(obj) {
    if ( obj.value == "" ) return;
    var formdata = new FormData();
    formdata.append("banner_img" , $(obj)[0].files[0]);//获取文件法二
    $.ajax({
        type : 'post',
        url : '/backend/banner/upimg',
        data : formdata,
        cache : false,
        processData : false, // 不处理发送的数据，因为data值是Formdata对象，不需要对数据做处理
        contentType : false, // 不设置Content-type请求头
        success : function(ret){
            
           
            $('#img_view').attr('src',ret);
            $('#img_src_input').val(ret);
        },
        error : function(){ }
    });
}
</script>